package com.dckeji.shiplock.webapp.util;

import com.dckeji.shiplock.framework.constants.SystemConstants;
import com.dckeji.shiplock.webapp.pojo.LogicRsult;

/**
 * Created with IntelliJ IDEA.
 * User: TianWei
 * Date: 2017/8/15
 * Time: 20:04
 */
public class ReturnMsgUtil {

    public static LogicRsult success(Object object) {
        LogicRsult logicRsult = new LogicRsult();
        logicRsult.setResultCode(SystemConstants.ResultCode.SUCCESS);
        logicRsult.setResultMsg(SystemConstants.ResultMsg.SUCCESS);
        logicRsult.setObj(object);
        return logicRsult;
    }


    public static LogicRsult success() {
        LogicRsult logicRsult = new LogicRsult();
        logicRsult.setResultCode(SystemConstants.ResultCode.SUCCESS);
        logicRsult.setResultMsg(SystemConstants.ResultMsg.SUCCESS);
        return logicRsult;
    }

    public static LogicRsult sysError() {
        LogicRsult logicRsult = new LogicRsult();
        logicRsult.setResultCode(SystemConstants.ResultCode.FIAL);
        logicRsult.setResultMsg(SystemConstants.ErrorMsg.SYS_ERROR);
        return logicRsult;
    }

    public static LogicRsult busError(String errorMsg) {
        LogicRsult logicRsult = new LogicRsult();
        logicRsult.setResultCode(SystemConstants.ResultCode.FIAL);
        logicRsult.setResultMsg(errorMsg);
        return logicRsult;
    }

    public static LogicRsult notData() {
        LogicRsult logicRsult = new LogicRsult();
        logicRsult.setResultCode(String.valueOf(SystemConstants.ResultCode.FIAL));
        logicRsult.setResultMsg(SystemConstants.ErrorMsg.NO_DATA);
        return logicRsult;
    }

    public static LogicRsult valiError() {
        LogicRsult logicRsult = new LogicRsult();
        logicRsult.setResultCode(String.valueOf(SystemConstants.ResultCode.FIAL));
        logicRsult.setResultMsg(SystemConstants.ErrorMsg.VALIDA);
        return logicRsult;
    }

    public static LogicRsult unique() {
        LogicRsult logicRsult = new LogicRsult();
        logicRsult.setResultCode(String.valueOf(SystemConstants.ResultCode.FIAL));
        logicRsult.setResultMsg(SystemConstants.ErrorMsg.UNIQUE);
        return logicRsult;
    }


}
